<template>
    <div class="bk-form bk-form-vertical">
        <template v-for="(obj, key) in atomPropsModel">
            <form-field
                v-if="!isHidden(obj, element)"
                :class="{ 'changed-prop': atomVersionChangedKeys.includes(key) }"
                :key="key"
                :desc="obj.desc"
                :desc-link="obj.descLink"
                :desc-link-text="obj.descLinkText"
                :required="obj.required"
                :label="obj.label"
                :is-error="errors.has(key)"
                :error-msg="errors.first(key)"
            >
                <component
                    :disabled="disabled"
                    :is="obj.component"
                    :container="container"
                    :element="element"
                    :name="key"
                    v-validate.initial="Object.assign({}, { max: getMaxLengthByType(obj.component) }, obj.rule, { required: !!obj.required })"
                    :handle-change="handleUpdateElement"
                    :value="element[key]"
                    v-bind="obj"
                    :placeholder="getPlaceholder(obj, element)"
                ></component>
                <route-tips v-bind="getComponentTips(obj, element)"></route-tips>
            </form-field>
        </template>
    </div>
</template>

<script>
    import atomMixin from './atomMixin'
    import validMixins from '../validMixins'
    export default {
        name: 'normal-atom',
        mixins: [atomMixin, validMixins]
    }
</script>
